﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DaoHam
{
    public class HangSo : BieuThuc
    {
        private float c;
        static private HangSo ZERO;

        static public HangSo getZero()
        {
            if (ZERO == null)
            {
                ZERO = new HangSo(0);
            }
            return ZERO;
        }

        protected HangSo(float _c)
        {
            this.c = _c;
        }

        static public HangSo TaoHangSo(float c)
        {
            if (c == 0)
            {
                return getZero();
            }
            return new HangSo(c);
        }

        public override float TinhBieuThuc(float x)
        {
            return c;
        }

        public override BieuThuc TinhDaoHam()
        {
            return new HangSo(0);
        }

        public override string XuatBieuThuc()
        {
            return "" + c;
        }

        public override string ToString(Convert cv)
        {
            return c.ToString();
        }
    }
}
